package io.r2mo.test.common.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.r2mo.dbe.mybatisplus.core.domain.BaseEntity;
import io.r2mo.dbe.mybatisplus.core.typehandler.TypedUUIDHandler;
import io.r2mo.typed.constant.DefaultConstantValue;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;

/**
 * @author lang : 2025-08-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tk_order")
@Schema(name = "订单")
public class OrderEntity extends BaseEntity {
    private String orderNo;

    private BigDecimal amountOrder;
    private BigDecimal amountDiscount;
    private BigDecimal amountPayed;
    private BigDecimal amountDelivery;
    private BigDecimal amountPackage;
    private String customerName;
    private String customerPhone;
    private String customerAddr;

    @DateTimeFormat(pattern = DefaultConstantValue.DEFAULT_META_DATETIME_PATTERN)
    private LocalDateTime orderAt;

    @DateTimeFormat(pattern = DefaultConstantValue.DEFAULT_META_DATETIME_PATTERN)
    private LocalDateTime payAt;

    @DateTimeFormat(pattern = DefaultConstantValue.DEFAULT_META_DATETIME_PATTERN)
    private LocalDateTime deliveryAt;

    private String payResult;

    @TableField(jdbcType = JdbcType.CLOB)
    private String remark;

    @TableField(jdbcType = JdbcType.CLOB)
    private String reason;

    @TableField(typeHandler = TypedUUIDHandler.class)
    private UUID platformId;

    @TableField(typeHandler = TypedUUIDHandler.class)
    private UUID shopId;

    @TableField(typeHandler = TypedUUIDHandler.class)
    private UUID merchantId;
}
